package com.heima.scan.init;

import com.heima.scan.dao.WmSensitiveDao;
import com.heima.utils.common.SensitiveWordUtil;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
public class WmNewsApplicationRunner implements ApplicationRunner {
    @Resource
    private WmSensitiveDao wmSensitiveDao;
    @Override

    public void run(ApplicationArguments args) throws Exception {
        List<String> sensitives = wmSensitiveDao.queryAll();
        SensitiveWordUtil.initMap(sensitives);
    }
}
